package bytebuf

import (
	"strings"
	"fmt"
)

func ToInt(v ...byte) int {
	result := 0
	for _, b := range v {
		result += int(b & 0x00FF)
	}

	return result
}

func ToHex(data []byte) string {

	sb := strings.Builder{}
	for _, b := range data {
		sb.WriteString(fmt.Sprintf("%02X ", b))
	}
	return strings.TrimSpace(sb.String())
}
